/*
 * @Author: Even
 * @Date: 2023-12-03 23:06:09
 * @LastEditors: Even
 * @LastEditTime: 2023-12-28 19:33:07
 * @FilePath: \opencos\include\manage_system\manage_system.h
 * @Description:
 */
#ifndef MANAGESYSTEM_H__
#define MANAGESYSTEM_H__

#include "customer/customer.h"
#include "item/item.h"
#include "manage_system/manage_status.h"
#include "order/order.h"
#include <string>
#include <vector>

#include "order_form/order_form.h"
#include "order_paying_dialog/order_paying_dialog.h"

class ManageSystem
{
public:
    void read_item_from_file(const std::string &dir);      // 从文件（数据库）中读取为表格，初始化item_tb,menu_tb
    void read_customer_from_file(const std::string &dir);  // 初始化customer_tb
    void read_order_from_file(const std::string &dir);     // 初始化order_tb

    void write_item_to_file(const std::string &dir);
    void write_customer_to_file(const std::string &dir);
    void write_order_to_file(const std::string &dir);

public:
    ManageStatus                      manage_status_;
    std::vector<Item>                 item_tb;
    std::vector<Order>                order_tb;
    std::unordered_map<int, Customer> customer_dict;

    Customer current_user;

    Order tmp_order;
};

using pManageSystem = std::shared_ptr<ManageSystem>;
extern pManageSystem sys;
#endif